package com.water.wl.newwater.adapter;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.water.wl.newwater.R;
import com.water.wl.newwater.bean.Blog;
import com.water.wl.newwater.bean.Tweet;

import java.util.List;

/**
 * Created by wds1993225 on 2016/3/14.
 */
public class BlogAdapter extends ArrayAdapter<Blog> {

    private int resourceId;

    public BlogAdapter(Context context, int resource, List<Blog> objects) {
        super(context, resource, objects);
        resourceId = resource;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Blog blog = getItem(position);
        Log.i("位置", "" + position);
        Log.i("内容",blog.getAuthor());
        View view = LayoutInflater.from(getContext()).inflate(resourceId,null);
        //TextView textView = (TextView)view.findViewById(R.id.tv_tweet_name);
        TextView textView = (TextView)view.findViewById(R.id.tv_tweet_name);

        textView.setText(blog.getAuthor());
        return view;
    }
}
